/*指令*/

$type:moon;
h2{
  @if($type==sun){
    color: #f00;
  }@else if($type==moon){
    color: #00f;
  }@else {
    color: #0f0;
  }
}

/*练习*/
/*
  做一个方法,获取背景色 (混合器,做线性渐变)
  如果数值>95 bg #f00, #faa
  如果数值>80 bg #00f, #0ff
  如果数值>60 bg #ff0, #ffa
  如果数值<=60 bg #000, #111
*/

@mixin get_bg_color($number){
  @if($number>95){
    background: linear-gradient(top, #f00, #faa);
  }@else if($number>80){
    background: linear-gradient(top, #00f, #0ff);
  }@else if($number>60){
    background: linear-gradient(top, #ff0, #ffa);
  }@else {
    background: linear-gradient(top, #000, #111);
  }
}

div{
  @include get_bg_color(62);
}